<?php

/**
 * This is the model class for table "{{r_surf_marcador}}".
 *
 * The followings are the available columns in table '{{r_surf_marcador}}':
 * @property integer $surf_marcador_id
 * @property integer $grid_programa_entidad_id
 * @property string $color
 * @property string $puntaje
 * @property integer $posicion
 * @property string $estado
 */
class RSurfMarcador extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return RSurfMarcador the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{r_surf_marcador}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('grid_programa_entidad_id, puntaje, posicion, estado', 'required'),
			array('grid_programa_entidad_id, posicion', 'numerical', 'integerOnly'=>true),
			array('color', 'length', 'max'=>50),
			array('puntaje', 'length', 'max'=>30),
			array('estado', 'length', 'max'=>40),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('surf_marcador_id, grid_programa_entidad_id, color, puntaje, posicion, estado', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'surf_marcador_id' => 'Surf Marcador',
			'grid_programa_entidad_id' => 'Grid Programa Entidad',
			'color' => 'Color',
			'puntaje' => 'Puntaje',
			'posicion' => 'Posicion',
			'estado' => 'Estado',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('surf_marcador_id',$this->surf_marcador_id);
		$criteria->compare('grid_programa_entidad_id',$this->grid_programa_entidad_id);
		$criteria->compare('color',$this->color,true);
		$criteria->compare('puntaje',$this->puntaje,true);
		$criteria->compare('posicion',$this->posicion);
		$criteria->compare('estado',$this->estado,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}